<div id="attach-root"></div>
<div class="panel panel-default">
    <div class="panel-heading">
        附件列表
        <div class="btn-group btn-group-sm">
            <button id="refresh" class="btn btn-info">刷新列表</button>
        </div>
    </div>
    <table class="table table-hover">
        <thead>
        <tr>
            <td>路径</td>
            <td>操作</td>
        </tr>
        </thead>
        <tbody>
        {% for url in items %}
        <tr>
            <td><a href='/attachments{{ "/u%d%s"%(uid,url) if uid else url}}' target="_blank">{{url}}</a></td>
            <td>
                <div class="btn-group btn-group-sm">
                    <button id="/personal/self/attach{{url}}" class="btn btn-danger">
                        删除
                    </button>
                </div>
            </td>
        </tr>
        {% end %}
        </tbody>
    </table>
</div>
<script type="text/javascript">
    $(document).ready(function () {
        $("button#refresh").click(function () {
            new Ajax("tab-item-attach", "/personal/self/attach");
        });
        $("button[id^='/personal/self/attach/']").click(function () {
            if (confirm("你确定要进行此操作么？")) {
                new Ajax("attach-root", $(this).attr("id"), "DELETE");
            }
        });
    });
</script>
<p>&nbsp;</p>